<?php

	class io_mock extends service {
		public function msg($msg){
			echo "io::msg() is called with param '{$msg}'<br>";
		}
	}

	class module_default extends module {
		
		public function exec(){
			context::msg("module_default::exec()");
		}




		private function test_mock(){
			context::save();
			
			#context::register_service("io",new io_mock());	//OR
			new io_mock("io");		//<- same as above
			
			$this->io->msg("Y HALLO THARE");	//will rout to io_mock::msg()

			context::restore();
			
			new io_mock("io_mock");
			context::msg("Y HALLO THARE");		//will rout by method 'msg' to io_mock::msg(), once again
			
			$this->io->msg("Y HALLO THARE");	//will rout to default io::msg()
		}
	}
?>
